#ifndef _CPU_H_
#define _CPU_H_

#include "gtmonitor.h"
#include "common.h"

/*
 * Structure for CPU statistics.
 * In activity buffer: First structure is for global CPU utilisation ("all").
 * Following structures are for each individual CPU (0, 1, etc.)
 */
struct stats_cpu {
    unsigned long long cpu_user __attribute__ ((aligned (16)));
    unsigned long long cpu_nice __attribute__ ((aligned (16)));
    unsigned long long cpu_sys  __attribute__ ((aligned (16)));
    unsigned long long cpu_idle __attribute__ ((aligned (16)));
    unsigned long long cpu_iowait   __attribute__ ((aligned (16)));
    unsigned long long cpu_steal    __attribute__ ((aligned (16)));
    unsigned long long cpu_hardirq  __attribute__ ((aligned (16)));
    unsigned long long cpu_softirq  __attribute__ ((aligned (16)));
    unsigned long long cpu_guest    __attribute__ ((aligned (16)));
};

extern unsigned long long interval;
extern unsigned long long cpu_working_uptime, cpu_record_uptime;
extern int cpu_nbr;
extern int cpu_initialized;
extern unsigned long long total_delta_time;
extern int is_cpu_recording;
extern char cpu_print_info[BUFFERSIZE];

void init_cpu(void);

void cpu_dump(void);

void refresh_cpu_usage(void);

int get_cpu_usage(void);

long get_cpu_deltatime(void);

long get_cpu_idle(void);

void cpu_cleanup(void);

#endif /* _CPU_H_ */
